﻿package com.kiklink.model.domain;

import java.util.List;

import org.json.JSONObject;

public class Page  {
	/**
	 * 接口返回的Json数据
	 */
	private JSONObject dataJsonObject;
	
	/**
	 * 哪种类型的page值."coach:教练","comment:评论","order:订单","product:课程","myProduct:我的课程"
	 */
	private Class<?> listclass;	
	/**
	 * 哪种类型的page值."coach:教练","comment:评论","order:订单","product:课程","myProduct:我的课程"
	 */
	private String pagetype;
	/**
	 * 数据列表
	 */
	private List<? extends BaseObject> list;
	/**
	 * 是否是首页
	 */
	private boolean firstPage;
	/**
	 * 第一个结果索引
	 */
	private int firstResult;
	/**
	 * 是否有下一页
	 */
	private boolean hasNextPage;
	/**
	 * 是否有上一页
	 */
	private boolean hasPreviousPage;
	/**
	 * 是否最后一页
	 */
	private boolean lastPage;
	/**
	 * 最后页面的数字
	 */
	private int lastPageNumber;
	/**
	 * 页码列表，有四页，则返回[1,2,3,4]
	 */
	private String linkPageNumbers;
	/**
	 * 下一页页码
	 */
	private int nextPageNumber;
	/**
	 * 每页数量
	 */
	private int pageSize;
	/**
	 * 上一页页码
	 */
	private int previousPageNumber;
	/**
	 * 1
	 */
	private int thisPageFirstElementNumber;
	/**
	 * 当前页结果数量
	 */
	private int thisPageLastElementNumber;
	/**
	 * 当前页码（从1开始）
	 */
	private int thisPageNumber;
	/**
	 * 总数量
	 */
	private int totalCount;
	
	
	
	public JSONObject getDataJsonObject() {
		return dataJsonObject;
	}
	public void setDataJsonObject(JSONObject dataJsonObject) {
		this.dataJsonObject = dataJsonObject;
	}
	public String getPagetype() {
		return pagetype;
	}
	public void setPagetype(String pagetype) {
		this.pagetype = pagetype;
	}



	public List<? extends BaseObject> getList() {
		return list;
	}
	public Class<?> getListclass() {
		return listclass;
	}
	public void setListclass() {
		if(pagetype.equals("Coach"))
			this.listclass =Coach.class;
		else if(pagetype.equals("Comment"))
			this.listclass =Comment.class;
		else if(pagetype.equals("Product"))
			this.listclass =Product.class;		
		else if(pagetype.equals("Order"))
			this.listclass =Order.class;
		else if(pagetype.equals("MyProduct"))
			this.listclass =MyProduct.class;
		else if(pagetype.equals("AdProduct"))
			this.listclass =AdProduct.class;
		else if(pagetype.equals("TransactionRecord"))
			this.listclass =TransactionRecord.class;		
		else if(pagetype.equals("Favorite"))
			this.listclass =Favorite.class;
		else if(pagetype.equals("KiklinkMessage"))
			this.listclass =KiklinkMessage.class;
		
		else
			this.listclass =null;	
	}
	public void setList(List<? extends BaseObject> list) {
		this.list = list;
	}
	public boolean isFirstPage() {
		return firstPage;
	}
	public void setFirstPage(boolean firstPage) {
		this.firstPage = firstPage;
	}
	public int getFirstResult() {
		return firstResult;
	}
	public void setFirstResult(int firstResult) {
		this.firstResult = firstResult;
	}
	public boolean isHasNextPage() {
		return hasNextPage;
	}
	public void setHasNextPage(boolean hasNextPage) {
		this.hasNextPage = hasNextPage;
	}
	public boolean isHasPreviousPage() {
		return hasPreviousPage;
	}
	public void setHasPreviousPage(boolean hasPreviousPage) {
		this.hasPreviousPage = hasPreviousPage;
	}
	public boolean isLastPage() {
		return lastPage;
	}
	public void setLastPage(boolean lastPage) {
		this.lastPage = lastPage;
	}
	public int getLastPageNumber() {
		return lastPageNumber;
	}
	public void setLastPageNumber(int lastPageNumber) {
		this.lastPageNumber = lastPageNumber;
	}
	public String getLinkPageNumbers() {
		return linkPageNumbers;
	}
	public void setLinkPageNumbers(String linkPageNumbers) {
		this.linkPageNumbers = linkPageNumbers;
	}
	public int getNextPageNumber() {
		return nextPageNumber;
	}
	public void setNextPageNumber(int nextPageNumber) {
		this.nextPageNumber = nextPageNumber;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getPreviousPageNumber() {
		return previousPageNumber;
	}
	public void setPreviousPageNumber(int previousPageNumber) {
		this.previousPageNumber = previousPageNumber;
	}
	public int getThisPageFirstElementNumber() {
		return thisPageFirstElementNumber;
	}
	public void setThisPageFirstElementNumber(int thisPageFirstElementNumber) {
		this.thisPageFirstElementNumber = thisPageFirstElementNumber;
	}
	public int getThisPageLastElementNumber() {
		return thisPageLastElementNumber;
	}
	public void setThisPageLastElementNumber(int thisPageLastElementNumber) {
		this.thisPageLastElementNumber = thisPageLastElementNumber;
	}
	public int getThisPageNumber() {
		return thisPageNumber;
	}
	public void setThisPageNumber(int thisPageNumber) {
		this.thisPageNumber = thisPageNumber;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return dataJsonObject.toString();
	}
	
}
